﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Loader
{
    /// <summary>
    /// Interaction logic for patientListItem2.xaml
    /// </summary>
    public partial class patientListItem2 : UserControl
    {
        public patient selectedPatient;
        public patientListItem2()
        {
            InitializeComponent();
        }

        public patientListItem2(patient p, List<ServiceReference2.EXE> exeAssignedList, List<ServiceReference2.session> patientSessionList, List<ServiceReference2.problem> problemList)
        {
            InitializeComponent();
            selectedPatient = p;
            int age = new DateTime(DateTime.Now.Subtract(p.DateOfBirth).Ticks).Year - 1;

            addressLabel1.Address1 = p.Address1;
            addressLabel1.Address2 = p.Address2;
            DOBValue.Text = String.Concat(p.DateOfBirth.ToShortDateString(), " (", age.ToString(), ")");
            nameLabel1.FamilyName = p.LastName;
            if (p.Gender.ToLower().Equals("m"))
            {
                GenderValue.Text = Microsoft.Cui.Controls.PatientGender.Male.ToString();
            }
            else if (p.Gender.ToLower().Equals("f"))
            {
                GenderValue.Text = Microsoft.Cui.Controls.PatientGender.Female.ToString();
            }

            nameLabel1.GivenName = String.Concat(p.FirstName);
            nameLabel1.Name = p.FirstName;
            img_patient.Source = p.Image;
            addressLabel1.Postcode = p.Postcode;
            nameLabel1.Title = p.Title;
            IdentifierValue.Text = p.Uid.ToString();
            //contactLabel1.WorkPhoneNumber = p.ContactNumWork;
            addressLabel1.Country = p.Country;
            //lblEname1.Text = p.E_name;
            //lblEContact1.Text = p.E_contactNum;
            //lblErelation1.Text = p.E_relationship;

            this.exeAssignedList = exeAssignedList;

            // retrieve all treatment analysis data
            this.patientSessionList = patientSessionList;

            //retrieve problems that the patient have
            this.problemList = problemList;
        }

        public List<ServiceReference2.EXE> exeAssignedList = new List<ServiceReference2.EXE>();
        public List<ServiceReference2.session> patientSessionList = new List<ServiceReference2.session>();
        public List<ServiceReference2.problem> problemList = new List<ServiceReference2.problem>();
    }
}
